import { AutoFight } from "./AutoFight";
import { Language } from "../../../../extend/language/Language";
import { GCheckBox } from "../../../../com/mui/controls/GCheckBox";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { AutoFightInfo } from "./AutoFightInfo";
type int = number;
//class OtherSetterPanel
    
    export  class OtherSetterPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._autoFightInfo = AutoFight.localAutoFight;
            this._itemArr = [];
            this._itemCbArr = [];
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc3=null;
            this._itemArr.push({"name":"autoCallPet", "label": Language.getString(34020)});
            this._itemArr.push({"name":"petEatDrug", "label": Language.getString(34021)});
            this._itemArr.push({"name":"autoBackCity", "label": Language.getString(34022)});
            this._itemArr.push({"name":"localeRevive", "label": Language.getString(34023)});
            var loc1=this.firstX;
            var loc2=this.firstY;
            var loc4=0;
            while (loc4 < this._itemArr.length) 
            {
                loc3 = new GCheckBox();
                loc3.styleName = "GCheckBox";
                loc3.name = this._itemArr[loc4].name;
                loc3.label = this._itemArr[loc4].label;
                loc3.buttonMode = true;
                if (loc4 != 2) 
                {
                    loc3.selected = true;
                }
                else 
                {
                    loc3.selected = false;
                }
                loc3.width = 220;
                loc3.x = loc1;
                loc3.y = loc2;
                loc3.addEventListener(flash.events.Event.CHANGE, this.onItemCbChangeHandler);
                this.addChild(loc3);
                this._itemCbArr.push(loc3);
                loc1 = loc1 + loc3.textField.textWidth + 40;
                if (loc4 == 2) 
                {
                    loc1 = this.firstX;
                    loc2 = loc2 + loc3.height + 3;
                }
                ++loc4;
            }
            ObjCreate.createBitmap(ImagesConst.Fire, 150, 22, this);
            var loc5;
            (loc5 = new Object /* flash.text.TextField */()).htmlText = "<font color=\'#00ff00\'>" + Language.getString(34025) + "</font>";
            loc5.width = 400;
            loc5.x = 170;
            loc5.y = 28;
            this.addChild(loc5);
            return;
        }

        /* internal  */onItemCbChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            var loc1=arg1.target as GCheckBox;
            this._autoFightInfo.setAutoFightInfo(loc1.name, loc1.selected);
            this._autoFightInfo.alter = true;
            return;
        }

        /* internal  */resetPanel(arg1: Boolean, arg2: Boolean, arg3: Boolean, arg4: Boolean): void
        {
            this._itemCbArr[0].selected = arg1;
            this._itemCbArr[1].selected = arg2;
            this._itemCbArr[2].selected = arg3;
            this._itemCbArr[3].selected = arg4;
            return;
        }

        public update(): void
        {
            this.resetPanel(this._autoFightInfo.callPet, this._autoFightInfo.petEatDrug, this._autoFightInfo.backCity, this._autoFightInfo.locRevive);
            return;
        }

        /* internal */ /* const */firstX: int=20;

        /* internal */ /* const */firstY: int=0;

        /* internal */ /* var */_autoFightInfo: AutoFightInfo;

        /* internal */ /* var */_itemArr: Array<any>;

        /* internal */ /* var */_itemCbArr: Array<any>;
    }
